package bloomersseeds2340

class SeedzRegistrationController {

    def index() {}
    
    def createSeed(){
        def seedInstance = new Seedz()
        seedInstance.properties = params
        
        
        //seed.save()
        
        print seedInstance.hardiness
        
        
        
        
        redirect (controller:'UserHome')
        
        //return [seedInstance: seedInstance]
    }
    
    def saveSeed(){
        def seed = new Seedz(params)
        
        
        if (seed.save(flush: true)) {
            //print seed.hardiness
            //flash.message="${message(code: 'default.created.message', args: [message(code: 'seedz.label', default: 'Seedz'), seed.id])}"
            session.user.seedArr.add(seed)
            render(view:"/seedzRegView/index", model: [annual: seed.annual, genus: seed.genus, species: seed.species, seedName: seed.seedName, variety: seed.variety, forma: seed.forma, hardiness: seed.hardiness])
            //redirect(controller: "UserHome")
            
            //this gives the id number for the seed id: seed.id
            //should prob use this to assign to current user
        }
        else {
            render(view:"index",model: [seed: seed])
        }
    }
}
